% Reinforcement Learning
% V1.5 
% -----------------------------------------

function start(obs,p)
global system_mode;
global policy_file;
global policy;
global home_path;

global starting_point;

addpath('files');
if(nargin<1)
    obs='0';
end
if(nargin<2)
    p='0';
end

if strcmp(system_mode, 'load')
    disp(sprintf('Learning until episode %s, starting from %s!', num2str(p), num2str(starting_point)));
elseif strcmp(system_mode,'learn')
    disp(sprintf('Learning for %s episodes!', num2str(p)));
elseif strcmp(system_mode, 'follow')
    disp(sprintf('Following policy %s for %s episodes!',policy_file, num2str(p)));
    
    savefile = strcat(home_path,'policies/',policy_file,'.mat');
    load(savefile, 'parameters');
    policy = parameters;
    
end

tic
simulator(obs,p);

end
